import java.util.Arrays;
import java.util.Collection;
import java.util.Random;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: XMQ
 * Date: 2022-06-14
 * Time: 15:36
 */
class Demo1{
    static String s1 = "123";
    static String s2;
    static {
        s2 = "456";
    }
    static void f1(){
        System.out.println("f1()" + s1);
        System.out.println("f1()" + s2);
    }
}
class Demo2{
    String s1;
    {
        s1 = "123";
    }

    public static void main(String[] args) {
        TestDemo.main3(new String[]{"first","the","main"});
    }
}
class Demo3{
    Demo3(String s){
        System.out.println(s);
    }
}
enum Demo4{
    INT,FLOAT,LONG

}
public class TestDemo {
    public static void main(String[] args) {
        Demo4 demo4;
        for (Demo4 s : Demo4.values()) {
            System.out.println(s+" " + Arrays.toString(Demo4.values()) + " " + s.ordinal());
        }
    }
    static void f(float i ,Character args){
        System.out.println("first");
    }
    static void f(char c ,Character args){
        System.out.println("second");
    }

    public static void main5(String[] args) {
        f(1,'a');
        f('a','b');

    }
    public static void main4(String[] args) {
        Demo3[] demo3s = new Demo3[]{
                new Demo3("apple"),
                new Demo3("banana"),
                new Demo3("orange"),
        };
//        for (Demo3 demo3 : demo3s) {
//            System.out.println(demo3);
//        }

    }
    public static void main3(String[] args) {
        for (String arg : args) {
            System.out.println(arg);
        }
        Random random = new Random(47);
        int[] a = new int[random.nextInt(5)];
        System.out.println(a.length);
        System.out.println(Arrays.toString(a));
    }
    public static void main2(String[] args) {
        Demo2 demo2 = new Demo2();
        System.out.println(demo2.s1);
    }
    public static void main1(String[] args) {
        Demo1.f1();
    }
}
